#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#define Max 100000
int main()
{
	int n = 0;
	int arr[Max] = { 0 };
	scanf("%d\n",&n);
	for (int i = 0; i <= n-1; i++)
	{
		scanf("%d", &arr[i]);
	}
	int max = arr[0];
	int min = arr[0];
	for (int i = 1; i < n; i++) {
		if (arr[i] > max) {
			max = arr[i];
		}
		if (arr[i] < min) {
			min = arr[i]; 
		}
	}
	printf("%d\n", max - min);

	return 0;
}